﻿<UserControl x:Class="Notoric.View.Music.CWNotation.Controls.Rest"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:me="clr-namespace:Notoric.View.Music.CWNotation.Controls"
             xmlns:vme="clr-namespace:Notoric.ViewModel.Elements.CWNotation;assembly=ViewModel"
             DataContextChanged="UserControl_DataContextChanged"
             Loaded="UserControl_Loaded"
             >
    <Canvas>
        <me:CoreSymbolDragThumb x:Name="PART_RestSymbol" Text="î" Canvas.Left="{Binding Position, Mode=OneWay}" Canvas.Top="{Binding Path=VerticalPosition, Mode=OneWay}"
                                FontFamily="MusicalSymbols" FontSize="{Binding EffectiveTypeSize, Mode=OneWay}" Cursor="Hand" IsHitTestVisible="False"
                                PreviewMouseLeftButtonDown="PART_RestSymbol_PreviewMouseLeftButtonDown">
            <me:CoreSymbolDragThumb.Template>
                <ControlTemplate TargetType="{x:Type me:CoreSymbolDragThumb}">
                    <TextBlock x:Name="PART_Symbol" Text="{TemplateBinding Text}"/>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="PART_Symbol" Property="Foreground" Value="Blue"/>
                        </Trigger>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding IsSelected, Mode=OneWay}" Value="True"/>
                                <Condition Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=FixedPage, AncestorLevel=1}}" Value="{x:Null}"/>
                            </MultiDataTrigger.Conditions>
                            <MultiDataTrigger.Setters>
                                <Setter TargetName="PART_Symbol" Property="Foreground" Value="Blue"/>
                            </MultiDataTrigger.Setters>
                        </MultiDataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </me:CoreSymbolDragThumb.Template>
        </me:CoreSymbolDragThumb>
        <ItemsControl x:Name="PART_Dots" ItemsSource="{Binding Path=AugmentationDots, Mode=OneWay}" Canvas.Top="{Binding VerticalPosition, Mode=OneWay}" IsHitTestVisible="False">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <Canvas Background="Transparent"/>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemTemplate>
                <DataTemplate DataType="{x:Type vme:AugmentationDot}">
                    <Canvas>
                        <TextBlock Text="." Canvas.Left="{Binding Position, Mode=OneWay}" FontFamily="MusicalSymbols" FontSize="{Binding Owner.EffectiveTypeSize, Mode=OneWay}"/>
                    </Canvas>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </Canvas>
</UserControl>
